/**
 * 
 */
package bancosys.tec.security.authorization;

/**
 * @author gigante
 * 
 */
public class TaskPermission extends AbstractPermission {

	/**
	 * C'tor
	 * 
	 * @param id
	 *            o nome da tarefa
	 */
	public TaskPermission(String id) {
		if (id == null) {
			throw new NullPointerException("Id can't be null.");
		}
		this.id = id;
		this.type = TaskPermission.class;
	}

	/**
	 * @see bancosys.tec.security.authorization.AbstractPermission#matchPermissionId(java.lang.String)
	 * @param tarefa
	 *            o nome da outra tarefa
	 * @return true se as duas tarefas são idênticas sem considerar diferença
	 *         entre letras maiúsculas e minúsculas
	 */
	@Override
	protected boolean matchPermissionId(String tarefa) {
		return tarefa.toUpperCase().trim().startsWith(this.id.toUpperCase().trim());
	}

}
